package handlerListen;


import com.nf.factory.ScanUtil;
import constantClass.Constant;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

public class HandlerListen implements ServletContextListener {

    @Override
    public void contextInitialized(ServletContextEvent servletContextEvent) {
        String url = servletContextEvent.getServletContext().getInitParameter("url");
        ScanUtil.scan(url);
        HandlerFactoryImp handlerFactoryImp = new HandlerFactoryImp();
        servletContextEvent.getServletContext().setAttribute(Constant.FACTORY,handlerFactoryImp);
    }

    @Override
    public void contextDestroyed(ServletContextEvent servletContextEvent) {

    }
}
